<!-- 一个尝试的通用主从表维护页面 -->
<!--  传入参数 relation=table1-table2:id-foreignId  -->
<%@page contentType="text/html;charset=UTF-8"%>
<jsp:directive.page import="cn.antia.cwin.window.MultiWindow"/>
<jsp:directive.page import="java.util.*"/>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<c:set value="${sessionScope.jwas_multi_window_id}" var="multiWindow"></c:set>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>${multiWindow.desc}</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="--主从表维护--">
	<meta http-equiv="description" content="This is my page">
	<script type="text/javascript" src="cep/js/mootools/mootools_hash.js"></script>
  </head>
  <script type="text/javascript">
  	var pri_sec = new Hash();
  	<% 
  	MultiWindow window = (MultiWindow)session.getAttribute("jwas_multi_window_id");
	HashMap relations = window.getRelations();
  	Object[] keys = relations.keySet().toArray();
  	String value,printStr;
  	for(int i = 0;i<keys.length;i++){
  		value = (String)relations.get(keys[i]);
  		printStr = "pri_sec.set('" + keys[i] + "','" +  value + "')";
  		out.print(printStr);
  	}
  	%>
  </script>
  <script language="javaScript">
  	function reloadSecondary(params){
  		alert(params);
  		return;
  		var pases = params.split("&");
  		for(var i = 0;i<pases.length;i++){
  			var akey = pases[i].split("=");
  			params = params.replaceAll(akey[0],pri_sec.get(akey[0]));
  		}
  		var url = "window.was?id=${multiWindow.secondary}&" + params;
  		window.secondary.document.location=url;
  	}
  </script>
  <frameset rows="50%,50%" framespacing="0" frameborder="yes" border="1">
  	<frame bordercolor="0" src="priWindow.was?id=${multiWindow.primary}&was=${multiWindow.primaryWas}" name="primary"/>
  	<frame bordercolor="0" src="window.was?id=${multiWindow.secondary}" name="secondary"/>
  </frameset>
</html>
